package com.mallcai.bigdata.ladon.service.report.impl.handler.support.rule;

import com.mallcai.bigdata.ladon.dpl.vo.DataType;
import com.mallcai.bigdata.ladon.utils.CollectionUtils;

import java.util.Collection;

/**
 * @author feixy
 * @version 1.0
 * @date 2019-08-15 19:00
 */
public class IsNotEmptyRuleOperator extends AbstractSingleRuleOperator{

    private static String[] commands = {"is not empty"};

    @Override
    protected boolean test(Object obj1) {
        if (obj1 !=null && obj1 instanceof Collection){
            return CollectionUtils.isNotEmpty((Collection) obj1);
        }
        return false;

    }

    @Override
    public DataType[] getSupportDataTypes() {
        return IRuleOperator.ALL_DATA_TYPE;
    }

    @Override
    public String[] getCommands() {
        return commands;
    }
}
